/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.tags;

import alcatelparser.modules.AlgoUtil;
import alcatelparser.modules.BuilderFactory;
import alcatelparser.modules.I;

/**
 *
 * @author geniuz
 */
public class ExchangeInfoTag extends DefaultParserTag
{

    public ExchangeInfoTag()
    {
    }

    public final void parseTag(int ai[], int i)
    {
        _array = ai;
        _startParsePosition = i;
        setStandartLength(ai, i);/*
        int j = AlgoUtil.getTag(ai, i + 2);
        if(isFullForm())
        {
            BuilderFactory.getBuilder().writeTagContent(3, 0, getTagPropertiesValue(I.I(6539)), getTagIdentifyContent(i, i + 1));
            if(toHex(j).equals(I.I(5536)))
                parseExchangeID(i + 2);
            else
                parseSoftwareVersion(i + 2);
        } else
        if(toHex(j).equals(I.I(5536)) && isTagChecked(I.I(2098)))
            parseExchangeID(i + 2);*/
    }

    private void parseSoftwareVersion(int i)
    {
        int j = AlgoUtil.getLength(_array, i + 1);
        String s = (new StringBuilder()).append(getTagIdentifyContent(i, i + 1)).append(getHexStringContent(i + 2, j)).toString();
        if(isFullForm())
        {
            BuilderFactory.getBuilder().writeTagContent(4, 0, getTagPropertiesValue(I.I(6509)), s);
            BuilderFactory.getBuilder().writeTagContent(9, 1, "", (new StringBuilder()).append(I.I(5979)).append(getStringContent(i + 2, j)).toString());
        } else
        if(isFieldsDecoding())
            BuilderFactory.getBuilder().writeTagContent(1, 0, getReducedTagPropertiesValue(I.I(6509)), getStringContent(i + 2, j));
        else
            BuilderFactory.getBuilder().writeTagContent(1, 0, getReducedTagPropertiesValue(I.I(6509)), getHexStringContent(i + 2, j));
    }

    private void parseExchangeID(int i)
    {
        int j = AlgoUtil.getLength(_array, i + 1);
        String s = (new StringBuilder()).append(getTagIdentifyContent(i, i + 1)).append(getHexStringContent(i + 2, j)).toString();
        if(isFullForm())
        {
            BuilderFactory.getBuilder().writeTagContent(4, 0, getTagPropertiesValue(I.I(2109)), s);
            BuilderFactory.getBuilder().writeTagContent(9, 1, "", (new StringBuilder()).append(I.I(5979)).append(getStringContent(i + 2, j)).toString());
        } else
        if(isTagChecked(I.I(2098)))
        {
            String s1 = isFieldsDecoding() ? getStringContent(i + 2, j) : getHexStringContent(i + 2, j);
            BuilderFactory.getBuilder().writeTagContent(1, 0, getReducedTagPropertiesValue(I.I(2109)), s1);
        }
    }

    public final String getParseIdentityTag()
    {
        return I.I(6506);
    }
}
